#coding=utf-8
from __future__ import unicode_literals
from DjangoUeditor.models import UEditorField

from django.db import models
from django.contrib.auth.models import User

class Person(models.Model):
    photo=models.FileField(u'照片')
    name=models.CharField(u'姓名',max_length=10)
    degree=models.CharField(u'头衔',max_length=20,choices=(('TC',u'教师'),('PD',u'博士后'),('DC',u'博士'),('MS',u'硕士'),('OT',u'其他')))
    # text=models.TextField(u'内容')
    content = UEditorField('内容', height=300, width=1000,
        default=u'', blank=True, imagePath="uploads/images/",
        toolbars='besttome', filePath='uploads/files/')
    def __unicode__(self):
        return self.name
class ScienceNews(models.Model):
    user = models.OneToOneField(User)
    timestamp=models.DateField(u'时间')
    title=models.CharField(u'标题',max_length=50)
    content = UEditorField('内容', height=300, width=1000,
        default=u'', blank=True, imagePath="uploads/images/",
        toolbars='besttome', filePath='uploads/files/')
    # content=models.TextField(u'内容')
    url=models.FileField(u'文件',default="")
    type=models.CharField(u'类别',max_length=20,choices=(('JR',u'期刊论文'),('DP',u'学位论文'),('RP',u'报告'),('MR',u'学术奖励'),('PI',u'专利发明')))
    def __unicode__(self):
        return self.title
class GeneralNews(models.Model):
    user = models.OneToOneField(User)
    timestamp=models.DateField(u'时间')
    title=models.CharField(u'标题',max_length=50)
    content = UEditorField('内容', height=300, width=1000,
        default=u'', blank=True, imagePath="uploads/images/",
        toolbars='besttome', filePath='uploads/files/')
    # content=models.TextField(u'内容')
    type=models.CharField(u'类别',max_length=20)
    def __unicode__(self):
        return self.title
class RecruitNews(models.Model):
    user = models.OneToOneField(User)
    timestamp=models.DateField(u'时间')
    title=models.CharField(u'标题',max_length=50)
    content = UEditorField('内容', height=300, width=1000,
        default=u'', blank=True, imagePath="uploads/images/",
        toolbars='besttome', filePath='uploads/files/')
    # content=models.TextField(u'内容')
    type=models.CharField(u'类别',max_length=20)
    def __unicode__(self):
        return self.title
class GeneralContent(models.Model):
    type=models.CharField(u'类别',max_length=10,choices=(('LI',u'实验室简介'),('AB',u'学术委员会'),('LD',u'研究方向'),('RI',u'科研简介'),('RD',u'研究方向'),('RP',u'研究课题')))
    title=models.CharField(u'标题',max_length=50)
    # content=models.TextField(u'内容')
    content = UEditorField('内容', height=300, width=1000,
        default=u'', blank=True, imagePath="uploads/images/",
        toolbars='besttome', filePath='uploads/files/')
    def __unicode__(self):
        return self.title